package com.gp8.tier3;

import java.io.Serializable;

//Pour RMI
import java.rmi.Remote;
import java.rmi.RemoteException;



//Pour REST
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import java.util.ArrayList;
import java.util.List;

@XmlRootElement(name = "Piaffeur")
public class Piaffeur implements Serializable, Remote {

	private static final long serialVersionUID = 1L;
	private String mail;
	private String pseudo;
	private String password;
	private ArrayList<Piafferie> listPiafferies = new ArrayList<Piafferie>();
	
	public Piaffeur(String pMail, String pPseudo, String pPassword) throws RemoteException {
		super();
		this.setMail(pMail);
		this.setPseudo(pPseudo);
		this.setPassword(pPassword);
	}

	public String getMail() throws RemoteException {
		return mail;
	}
	
	public void setMail(String pMail) throws RemoteException {
		this.mail = pMail;
	}
	
	public String getPseudo() throws RemoteException {
		return pseudo;
	}
	
	public void setPseudo(String pPseudo) throws RemoteException {
		this.pseudo = pPseudo;
	}
	
	public String getPassword() throws RemoteException {
		return password;
	}
	
	public void setPassword(String pPassword) throws RemoteException {
		this.password = pPassword;
	}
	
	public List<Piafferie> getListPiafferies() throws RemoteException {
		return listPiafferies;
	}
	
	public void addPiafferie(Piafferie pPiafferie) throws RemoteException {
		this.listPiafferies.add(pPiafferie);
	}
	
	@Override
    public boolean equals(Object object)
    {
        boolean same = false;

        if (object != null && object instanceof Piaffeur)
        {
        	same = (this.mail.equals(((Piaffeur)object).mail));
        }

        return same;
    }
	
	@Override
    public int hashCode() {
        int hash = 1;
        hash = hash + mail.hashCode();
        return hash;
    }
	
}
